//打开指定窗口信息，常用于编辑，添加等
function edit(url,title="编辑信息",width='880px',height='90%'){
  parent.layer.open({
          type: 2,
          title: title,
          shadeClose:true,
          shade: 0.4,
          maxmin: true, //允许全屏最小化 
          resize:false,
          area: [width,height],
          content: url  //iframe的url
        }); 
}
function add(url,title='添加信息',width='880px',height='90%'){
  parent.layer.open({
          type: 2,
          title: title,
          shadeClose:true,
          shade: 0.4,
          area: [width,height],
          maxmin: true, //允许全屏最小化      
          resize:false,
          content: url  //iframe的url
        }); 
}
//单个删除
function del(url){
  parent.layer.msg('您确定要删除吗？', {
    time: 0 //不自动关闭
    ,btn: ['确定', '取消']
    ,yes: function(index){
      parent.layer.close(index);
            $.get(url,function(json){
                    if(json.code == 0){
                          parent.layer.msg(json.msg);
                            setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
                            window.location.reload();//页面刷新
                          },1000);
                   }else if(json.code == -1){
                     parent.layer.msg(json.msg, {time: 5000, icon:5});
                   }
               });
    }
  });
}
//新的空白页面打开
function blank(url){
  window.location.href= url;
}
//返回之前页面
function back(){
  javascript:history.go(-1);
}


function audit(obj){
  var url = obj.getAttribute('data-url');
  $.get(url,function(json){
    if(json.code == 0){
      parent.layer.msg(json.msg);
      location.reload();
    }
  });
}
